
from flask_admin import Admin, BaseView, expose
from flask_admin.contrib.sqla import ModelView

from .myapp import db
from .models import *

class UserAdmin(ModelView):
    '''用户管理'''
    can_create          = True # 打开添加
    can_view_details    = True # 打开细节显示
    can_export          = True # 打开导出
    column_display_pk   = True # 显示主键
    # 去掉显示password这一列
    #  column_exclude_list = ['password', ]
    # ['username', 'telephone']这两列可修改
    column_editable_list = ['username', 'telephone']
    # 打开索引,可按['username',]模糊索引，
    column_searchable_list = ['username']
    # 重命名列
    column_labels       = {
            'id': u'编号',
            'username': u'姓名',
            'password': u'密码',
            'telephone': u'电话',
            'email': u'邮箱',
            'qq': u'qq',
        }
    #  inline_models = (RegisterMsg,)
    pass